package chapter3.xmlBean;

import java.util.List;

public class Person {
    private String name;  
    private int age;  
    private List list;
    //无参构造函数,无属性值时采用无参构造函数的默认构造函数
    public Person() {
        this.name = "无参默认构造函数";
        this.age = 28;
    }
    //有参数构造方法
    public Person(String name, int age, List list) {
        this.name = name;
        this.age = age;
        this.list = list;
    }
    public void setName(String name) {  
              this.name= name;  
    }  
    public void setAge(int age) {  
              this.age= age;  
    }  
    public void setList(List list) {
		this.list = list;
	}
	public void sayHello(){  
        String message = "Hello "+this.name+",your age is "+this.age;
        System.out.println(message);
        for(int i = 0; i < this.list.size(); i ++) {
            System.out.println(this.list.get(i).toString());
        }
    }  
}
